/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.edu.com1263.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Luiz Cardoso
 */
@Entity
@Table(name="tarefa")
public class Tarefa implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="id_tarefa")
	private Long id;
	
	@Column(name="cod_tarefa", nullable=false)
    String codTarefa;
	
	@Column(name="nome_tarefa", nullable=false)
    String nomeTarefa;
	
	@Column(name="descricao_Tarefa", nullable=false)
    String descricaoTarefa;
		
	@Temporal(TemporalType.DATE)
	@Column(name = "inicio")
	private Date inicio;

	@Temporal(TemporalType.DATE)
	@Column(name = "termino")
	private Date termino;
	
	@Column(name="status")
	private StatusTarefa status;
	
	

	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "tarefa")
	private Collection<TrabalhoPostado> postados;
	
	
	@ManyToMany
	@JoinTable(name = "tarefa_paradigma", 
			joinColumns = { @JoinColumn(name = "id_tarefa") }, 
			inverseJoinColumns = { @JoinColumn(name = "id_paradigma") })
	private Collection<Paradigma> paradigmas;
	
	
	@ManyToOne
	@JoinColumn(name = "id_turma")
	private Turma turma;

	
	
	
	public Tarefa(String codTarefa, String nomeTarefa, String descricao, Date inicio, Date termino) {
		this.codTarefa = codTarefa;
		this.nomeTarefa = nomeTarefa;
		this.descricaoTarefa = descricao;
		this.inicio = inicio;
		this.termino = termino;
	}


	public Tarefa() {
		postados = new HashSet<TrabalhoPostado>();
		paradigmas = new HashSet<Paradigma>();
	}
	

    public String getCodTarefa() {
        return codTarefa;
    }

    public void setCodTarefa(String codTarefa) {
        this.codTarefa = codTarefa;
    }

   
    public Date getInicio() {
		return inicio;
	}

	public void setInicio(Date inicio) {
		this.inicio = inicio;
	}



	public Date getTermino() {
		return termino;
	}

	public void setTermino(Date termino) {
		this.termino = termino;
	}


	public Collection<TrabalhoPostado> getPostados() {
		return postados;
	}



	public void setPostados(Collection<TrabalhoPostado> postados) {
		this.postados = postados;
	}



	public Collection<Paradigma> getParadigmas() {
		return paradigmas;
	}


	public void setParadigmas(Collection<Paradigma> paradigmas) {
		this.paradigmas = paradigmas;
	}


	public Long getId() {
		return id;
	}


	public void setId(Long id) {
		this.id = id;
	}


	public StatusTarefa getStatus() {
		return status;
	}


	public void setStatus(StatusTarefa status) {
		this.status = status;
	}


	public String getDescricaoTarefa() {
		return descricaoTarefa;
	}


	public void setDescricaoTarefa(String descricaoTarefa) {
		this.descricaoTarefa = descricaoTarefa;
	}


	public String getNomeTarefa() {
		return nomeTarefa;
	}


	public void setNomeTarefa(String nomeTarefa) {
		this.nomeTarefa = nomeTarefa;
	}


	public Turma getTurma() {
		return turma;
	}


	public void setTurma(Turma turma) {
		this.turma = turma;
	}


	




}
